#define _CRT_SECURE_NO_WARNINGS	1
using namespace std;
#include<stdio.h>
#include<algorithm>
#include<vector>
class Solution {
public:
    int minSubArrayLen(int target, vector<int>& nums) {
        int n = nums.size();
        sort(nums.begin(), nums.end());
        int a = n;
        for (int i = 0; i < n; i++)
        {
            int left = i, right = i, sum = 0;
            while (right < n)
            {
                sum += nums[right];
                right++;

                if (sum > target)
                {
                    break;

                }
                else if (sum == target)
                {
                    int len = right - left + 1;
                    a = min(len, a);
                }
            }

        }
        return a;

    }
};
int main()
{


    int num[] = { 2,3,1,2,4,3 };
    int ret = Solution:: minSubArrayLen(7, num);
}